package com.vf.admin.platform.service.impl;

import com.vf.admin.platform.dao.ElementDao;
import com.vf.admin.platform.dao.RoleMenuElementDao;
import com.vf.admin.platform.entity.Element;
import com.vf.admin.platform.service.ElementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ElementServiceImpl implements ElementService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private ElementDao elementDao;
    @Autowired
    private RoleMenuElementDao roleMenuElementDao;


    @Override
    public void saveOrUpdate(Element element) {
        elementDao.saveOrUpdate(element);
    }

    @Override
    public Element get(Integer id) {
        return elementDao.get(id);
    }

    @Override
    public List<Element> findList(Map<String, Object> paraMap) {
        return elementDao.findList(paraMap);
    }

    @Override
    public void del(int id) {
        elementDao.del(id);
        roleMenuElementDao.delByElementId(id);
    }

    @Override
    public void delByMenuId(int menuid) {
        elementDao.delByMenuId(menuid);
    }
}
